<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> 
<head>
	<title><?php echo $title_for_layout?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- Framework CSS -->
    <?php echo $html->css('homepage')?>
    <?php echo $html->css('blueprint/plugins/sprites/sprite')?>
	<?php echo $html->css('slide')?>
	<?php echo $javascript->link('slide')?>
	<?php echo $javascript->link('ddaccordion')?>
	<?php 
		if (!isset($_SESSION['lang']))
    	{
    		$_SESSION['lang'] = 'vi';
    	}
    	//	unset($_SESSION['c_id']);
    	//neu nhu chua nhan. session['c_id'] gan o controller home/product_category thi session = ""
    	if (empty($_SESSION['c_id']))
    	{
    		$_SESSION['c_id'] = "a";	
    	}    	
	?>	
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
	<!--	script lam menu category-->
	<script type="text/javascript">
		$(document).ready(function (){
			var kkk = 0;
			var remove = 0;
			var session = '<?=$_SESSION['c_id']?>';
			$('#nav > li').addClass('abc');
			if(session == 'a')
			{
				$('.abc > a').addClass('CatOne');
			}
			$('#nav').find('li:has(a#<?=$_SESSION['c_id']?>)').addClass('normal');
			$('#nav > li > ul').find('li:has(a#<?=$_SESSION['c_id']?>)').removeClass('normal');
			function style_category() {				
				$(".abc").click(function () {
					var index = $('.abc').index(this);
					$(".abc").removeClass('normal');					
					$('.abc > a').removeClass('down');			
					if(remove == 0)
					{
						$(this).addClass('normal');
						$('.abc > a').eq(index).addClass('down');
					}		
					var length = $('.abc').eq(index).children('ul').children('li').length;
					if(length == 0)
					{						
						return true;						
					}
					else 
					{
						
						if(kkk == 1)
						{
							
							kkk = 0;
							return true;
						}
						else						
							return false;	
					}	    
				}); 
				
				$(".abc >a").click(function () {	
					remove = 0;				
					var index = $('.abc >a').index(this);
					$('.abc').children('ul').slideUp();
					if($(".abc").eq(index).children('ul').eq(0).attr('offsetHeight') == 0)
					{
						$(".abc").eq(index).children('ul').eq(0).slideToggle();
					} else {
						remove = 1;
						$(this).removeClass('down');
						$('.abc').removeClass('normal');
					}
				});
				
				$('#nav > .abc > ul >li >a').click(function(){
//					alert($(this).attr('class'));
					kkk = 1;
					return true;
				});
				
				//$('#nav').css({'background:red;'});		
				$('#nav > li > ul').addClass('ul_news');
				$('#nav > li > a').addClass('CatOne');
				$('#nav > li > a').css({'color':'#FFF'});
				
				var a_href = $('#<?=$_SESSION['c_id']?>').attr('href');				
				$('#nav').find('ul:has(a[href="'+a_href+'"])').addClass('showchild ul_news');
				
				$('#<?=$_SESSION['c_id']?>').parent().find('ul:first').addClass('showchild ul_news');					
			}
			style_category();
		});
	</script>
	
	<script>
	 $(document).ready(function(){
		   var pathname = window.location.pathname;
		   if(pathname.indexOf('index') >= 0)
		   {
			   $(".menu_item-1").addClass("menu-item-1-selected");
		   }
		   //introduction
		   if(pathname.indexOf('introduction') >= 0)
		   {
			   $(".menu_item-2").addClass("menu-item-2-selected");
		   }
		   //customize
		   if(pathname.indexOf('customize') >= 0)
		   {
			   $(".menu_item-3").addClass("menu-item-3-selected");
		   }
		   if(pathname.indexOf('product') >= 0)
		   {
			   $(".menu_item-4").addClass("menu-item-4-selected");
		   }
		   //services
		   if(pathname.indexOf('services') >= 0)
		   {
			   $(".menu_item-5").addClass("menu-item-5-selected");
		   }
		   //warranty
		   if(pathname.indexOf('warranty') >= 0)
		   {
			   $(".menu_item-6").addClass("menu-item-6-selected");
		   }
		   //career
		   if(pathname.indexOf('career') >= 0)
		   {
			   $(".menu_item-7").addClass("menu-item-7-selected");
		   }
		   //contact
		   if(pathname.indexOf('contact') >= 0)
		   {
			   $(".menu_item-8").addClass("menu-item-8-selected");
		   }
		   
	 });
	
	</script>
	
	<style type="text/css">
		
		table.rate 
		{
			border: 1px solid #bfeafc;
			width:300px;
			border-collapse: collapse;
			color:#bfeafc;
		}
		
		table.rate td { border: 1px solid #bfeafc; }
		
		.menu_item-1, .menu_item-2, .menu_item-3, .menu_item-4, .menu_item-5, .menu_item-6, .menu_item-7, .menu_item-8  
		{
			background-image:url(/img/<?php if($_SESSION['lang'] == 'en') echo 'menuen.png'; else if ($_SESSION['lang'] == 'vi') echo 'menu.png'?>);
			background-repeat: no-repeat;
			height:26px;
			width:100px;
			float:left;
			margin-right:2px;
		}
		
		.menu_item-1{background-position: -14px 0px; margin-left:80px;}
		.menu_item-2{background-position: -116px 0px; }
		.menu_item-3{background-position: -218px 0px;width:104px;}
		.menu_item-4{background-position: -324px 0px}
		.menu_item-5{background-position: -427px 0px;width:91px;}
		.menu_item-6{background-position: -520px 0px;}
		.menu_item-7{background-position: -622px 0px;}
		.menu_item-8{background-position: -724px 0px;width:86px;}
		
		.menu_item-1:hover, .menu-item-1-selected{background-position: -14px -27px}
		.menu_item-2:hover, .menu-item-2-selected{background-position: -116px -27px}
		.menu_item-3:hover, .menu-item-3-selected{background-position: -218px -27px;}
		.menu_item-4:hover, .menu-item-4-selected{background-position: -324px -27px}
		.menu_item-5:hover, .menu-item-5-selected{background-position: -427px -27px;}
		.menu_item-6:hover, .menu-item-6-selected{background-position: -520px -27px;}
		.menu_item-7:hover, .menu-item-7-selected{background-position: -622px -27px;}
		.menu_item-8:hover, .menu-item-8-selected{background-position: -724px -27px;}
	</style>
</head>
<body onload="style_category()">
	<div class="container">
		<div id="header" class="showgrid span-8 last">
			<div class="span-8" style="height:186px;" >
				<div style="float: right; width: 70px; margin-top: 10px; margin-right: 10px;">
					<div style="float: left;">
						<a href="<?php echo $html->url('/language/change/en');?>" > 
							<?php echo $html->image('britain.png', array('alt' => "English", 'title' => " English ",'width' => 33)); ?>
						</a>
					</div>
					<div style="float: right;">
						<a href="<?php echo $html->url('/language/change/vi'); ?>" >
							<?php echo $html->image('vietnam.png', array('alt' => "Vietnamese", 'title' => " Vietnamese ", 'width' => 33)); ?>
						</a>
					</div>
				</div>
			</div>
			<div class="menu_item-1" onclick="window.location =' <?php echo   $html->url('index')?>'" >&nbsp;</div>
			<div class="menu_item-2" onclick="window.location =' <?php echo   $html->url('introduction')?>'">&nbsp;</div>
			<div class="menu_item-3" onclick="window.location =' <?php echo   $html->url('customize')?>'" >&nbsp;</div>
			<div class="menu_item-4" onclick="window.location =' <?php echo   $html->url('product_category')?>'">&nbsp;</div>
			<div class="menu_item-5" onclick="window.location =' <?php echo   $html->url('services')?>'" >&nbsp;</div>
			<div class="menu_item-6" onclick="window.location =' <?php echo   $html->url('warranty')?>'" >&nbsp;</div>
			<div class="menu_item-7" onclick="window.location =' <?php echo   $html->url('career')?>'">&nbsp;</div>
			<div class="menu_item-8 last" onclick="window.location =' <?php echo   $html->url('contactus')?>'">&nbsp;</div>
        </div>
        <!-- End Header -->
        <div id="middle" class="span-8 last">        	
			<div class="span-8 last" style="height:5px;">&nbsp;</div>
			<div id="middle_left" class="span-2">
				<div class="h_menu">
					
					<div class="title_img">
						<a href="#">
							<?php if($_SESSION['lang'] == 'vi') {?>
								Danh mục
							<?php } else if($_SESSION['lang'] == 'en') {?>
								Categories
							<?php }?>
						</a>
					</div>
					<div class="h_menu_items" style="background:#014670">
						<?php echo $this->renderElement('category_menu')?>
					</div>
				</div>
				
				<div style="height:10px;">&nbsp;</div>
				<div class="h_menu">					
					<div class="title_img">
						<a href="#">
							<?php if($_SESSION['lang'] == 'vi') {?>
								Tìm theo thương hiệu
							<?php } else if($_SESSION['lang'] == 'en') {?>
								Search by brand
							<?php }?>
						</a>
					</div>
					<div class="h_menu_items" style="background: url('<?php echo $html->url('/img/bg_timtheothuonghieu.jpg')?>') no-repeat">
						<?php echo $this->renderElement('product_brands')?>
					</div>
				</div>
			</div>
			<!-- End Hozi Menu -->
			<div id="middle_center" class="span-4">
				&nbsp;
				<!-- CONTENT -->
				<?php echo $content_for_layout; ?>
				<!-- END CONTENT -->
			
			</div>
			<div id="middle_right" class="span-2 last">
				<div class="h_menu">
					<div class="title_img_right">
						<a class="no_icon" href="#">
							<?php if($_SESSION['lang'] == 'vi') {?>
								Đăng nhập
							<?php } else if($_SESSION['lang'] == 'en') {?>
								Login
							<?php }?>	
						</a>
					</div>
					<div class="h_menu_items">
					<?php
					   $user = $this->requestAction('users/helloUser');
					   if(!$user)
					   {
					   	   
					?>
						<div style="color: red">
							<?php
							if ($session->check('Message.auth')): 
							           $session->flash('auth'); 
							       endif;
							 ?>
						</div>
					<?php 
						echo $form->create('User', array('action' => 'login'));
					?>
						<table cellpadding="0" cellspacing="0" style="margin-left: 3px; margin-top: 12px; margin-bottom: 12px;">
							<tr>
								<td style="padding: 0; margin: 0">Tài khoản</td>
								<td style="padding: 0; margin: 0"><?php echo $form->input('username',array('style'=>'width:130px; height: 18px;', 'label' => ''));?></td>
							</tr>
							<tr>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td style="padding: 0; margin: 0">Mật khẩu</td>
								<td style="padding: 0; margin: 0"><?php echo $form->input('password',array('style'=>'width:130px; height: 18px', 'label' => ''));?></td>
							</tr>
							<tr>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td style="padding: 0; margin: 0">&nbsp;</td>
								<td style="padding: 0; margin: 0"><button type="submit">Đăng nhập</button></td>
							</tr>
						</table>
					<?php
						echo $form->end();
					   }
					   else
					   {
					?>
					<p style="text-align:right; margin-left:20px">
					<br />
						<?php if($_SESSION['lang'] == 'vi') {?>
							Xin chào :
						<?php } else if($_SESSION['lang'] == 'en') {?>
							Hello :
						<?php }?>
						<?php echo $user['User']['username']?>,
						<br />
					<a href="<?php echo $html->url('/users/profile/'.$user['User']['id'])?>" title="Edit your profile">Your Profile</a>
					<!--<span style="display: inline;" class="turbo-nag hidden"> | <a href="#">Turbo</a></span> -->
					| <a href="<?php echo $html->url('/users/logout')?>" title="Log Out">Log Out</a></p>
					<br />
					<?php
					   }
				   ?>
						
					</div>
				</div>
				<div class="end_div"></div>
				<!-- End Accoun information -->
				
			
				<div style="height:10px;">&nbsp;</div>
				<div class="h_menu">
					<div class="title_img_right">
						<a href="#">
							<?php if($_SESSION['lang'] == 'vi') {?>
								Tư vấn online
							<?php } else if($_SESSION['lang'] == 'en') {?>
								Consulting 
							<?php }?>							
						</a>
					</div>
					
					<div class="h_menu_items" style="padding: 5px; text-align:center">
						<?php echo $this->renderElement('ym')?>
					</div>
				</div>
				<div class="end_div"></div>
				<div style="height:10px;">&nbsp;</div>
				<div class="h_menu">					
					<div class="title_img_right">
						<a class="no_icon" href="#">
							<?php if($_SESSION['lang'] == 'vi') {?>
								Ngoại tệ
							<?php } else if($_SESSION['lang'] == 'en') {?>
								Exchange
							<?php }?>
						</a>
					</div>
					
					<div class="h_menu_items" style=" text-align:center ;">
						<div style="height:10px;">&nbsp;</div>
						<?php echo $this->renderElement('currentcy')?>
						<div style="height:10px;">&nbsp;</div>
					</div>
				</div>
				<div class="end_div"></div>
				<div style="height:10px;">&nbsp;</div>
				<div class="h_menu">
					<?php echo $this->renderElement('downloadfiles')?>
				</div>
				<br />
				<div class='advs' style='text-align:center'>
					<img src='<?php echo $html->url('/img/quangcao2.jpg')?>' />
				</div>
				<div style="height:10px;">&nbsp;</div>
				<div style="text-align:center"><img src="<?php echo $html->url('/img/quangcao1.jpg')?>" /></div>
			</div>
			<div class="span-8 last">
				<br/>
			</div>
        </div>
		<div id="bottom" class="span-8 last" style="">
			<div class="span-2"><img src="<?php echo $html->url("/img/logo.jpg");?>" style="margin: 5px 0px 0px 10px;"></img></div>
			<div class="span-6 last" style="text-align:right">
				<div style="margin-top:5px;">
				TONY COMPUTER
				<br />
				Địa chỉ: 12A11 Lý Nam Đế - Hoàn Kiếm - Hà Nội - ĐT:04.37475192, 04.37473876, 0915559787
				<br />
				Email: admin@tonycomputer.com.vn
				</div>
			</div>
        </div>
	</div>
	<?php unset($_SESSION['c_id'])?>
</body>
</html>